﻿using System.Xml.Serialization;

namespace SverigesRadio.SverigesRadioApp.Business.Model
{
    public class Program
    {
        [XmlElement("unitid")]
        public string Id { get; set; }

        [XmlElement("poddid")]
        public string PodId { get; set; }

        [XmlElement("title")]
        public string Title { get; set; }

        [XmlElement("description")]
        public string Description { get; set; }

        [XmlAttribute("archived")]
        public bool Archived { get; set; }

        public string TrimmedTitle
        {
            get { return Title.Trim(); }
        }

        public string DescriptionOrTitle
        {
            get
            {
                return string.IsNullOrWhiteSpace(Description) ? Title : Description;
            }
        }

        public char FirstCapital
        {
            get
            {
                if (TrimmedTitle.Length > 0)
                    return TrimmedTitle[0];

                return ' ';
            }
        }
    }
}
